<?php
$content = file_get_contents(__DIR__.'/Uni2Pinyin');
$content = iconv('UTF-8', 'UTF-8//IGNORE', utf8_encode($content));
$lines = explode("\n",$content);
$unicodePinyinMap = array();
foreach($lines as $line){
    $line = trim($line);
    if (empty($line)){
        continue;
    }
    if ($line[0]==='#'){
        continue;
    }
    $thisData = explode("\t",$line);
    $code = array_shift($thisData);
    $code = hexdec($code);
    if (empty($thisData)){
        continue;
    }
    $code = (string)$code;
    $unicodePinyinMap[$code] = $thisData;
}
$data = json_encode($unicodePinyinMap);
file_put_contents(__DIR__.'/data.json',$data);
